package com.bertie.smiles2iupac;

public class Bond {
    private Atom atom1, atom2;

    public Bond(Atom atom1, Atom atom2) {
        this.atom1 = atom1;
        this.atom2 = atom2;
    }

    public Atom getAtomAtOtherEnd(Atom atom) {
        if (atom == atom1) {
            return atom2;
        }
        if (atom == atom2) {
            return atom1;
        }
        throw new IllegalArgumentException(atom + " this atom is not at any side of the bond");
    }
}
